Skip to content

Add -topo_zk_auth_file flag#4733

Merged
sougou merged 2 commits intovitessio:masterfrom
adsr:patch-zk-auth
Mar 31, 2019
Merged

Add -topo_zk_auth_file flag#4733
sougou merged 2 commits intovitessio:masterfrom
adsr:patch-zk-auth

Conversation

@adsr
Copy link
Copy Markdown
Collaborator

@adsr adsr commented Mar 18, 2019

If the flag is specified, Vitess clients will send an auth packet at connect time. This allows for the use of ACLs on the ZooKeeper side. We are using this for basic digest:user:pass authentication. Relevant ZooKeeper docs:

https://zookeeper.apache.org/doc/r3.4.13/zookeeperProgrammers.html#sc_BuiltinACLSchemes

@adsr adsr requested a review from sougou as a code owner March 18, 2019 21:26
Signed-off-by: Adam Saponara <as@php.net>
return
}

// GetW is part of the Conn interface.
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

these comments obviously add no value but I'm pretty sure some linter or the other (maybe gofmt) will complain about this.

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I deleted the comments because, afaict, they are not part of the Conn interface from go/vt/topo/conn.go although I may be missing something.

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

These should have generated lint errors. These comments are required by go coding standards: https://github.com/golang/go/wiki/CodeReviewComments#doc-comments. I know it's silly, but we'll need to add them back in.

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Added back in

return fmt.Errorf("addAuth: expected args <scheme> <auth>")
}
scheme, auth := subFlags.Arg(0), subFlags.Arg(1)
return zconn.AddAuth(ctx, scheme, []byte(auth))
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

are there any assumptions about the args that should be validated here?

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think we can only validate if we limit the schemes -- e.g., digest scheme should have format user:pass, ip scheme should have format addr/mask. However, ZooKeeper's auth system is pluggable, so someone could write scheme foobar with some unknown format which we cannot validate.

Signed-off-by: Adam Saponara <as@php.net>
@adsr
Copy link
Copy Markdown
Collaborator Author

adsr commented Mar 25, 2019

Bump @deepthi @sougou :)

Copy link
Copy Markdown
Collaborator

@deepthi deepthi left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@deepthi
Copy link
Copy Markdown
Collaborator

deepthi commented Mar 28, 2019

@sougou can you take a look one more time? if it looks good, I can merge it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants